/**
 * @file MainForm
 *
 * @brief 
 *
 * @author gyzheng
 *
 * @mail gyazheng@gmail.com
 *
 * @date 07/27/2011 22:37:51 
 *
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using CarFrameWork.Model;
using CarFrameWork.UI.Common;

namespace CarFrameWork.UI.SystemManage.ModelManage
{
    public partial class ModelFormBase : DetailForm
    {
        protected ModelReg m_ModelInfo;
        public ModelFormBase()
        {
            InitializeComponent();
        }

        private bool InspectionText(TextBox text)
        {
            if (string.Empty == text.Text.Trim())
                return false;
            return true;
        }

        protected bool TestContent()
        {
            if (!InspectionText(this.txtModelName))
                return false;
            if (!InspectionText(this.txtObjectName))
                return false;
            if (!InspectionText(this.txtDescript))
                return false;
            return true;
        }

        protected void SetModelToForm()
        {
            txtModelId.Text = m_ModelInfo.ModuleID.ToString();
            txtModelName.Text = m_ModelInfo.ModuleName;
            txtObjectName.Text = m_ModelInfo.ObjectName;
            txtDescript.Text = m_ModelInfo.Description;
        }

        protected void GetFormToModel()
        {
            m_ModelInfo.ModuleName = txtModelName.Text;
            m_ModelInfo.ObjectName = txtObjectName.Text;
            m_ModelInfo.Description = txtDescript.Text;
        }

        private void quitBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}